package org.ljj.xml.controller;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.springframework.web.servlet.mvc.LastModified;

public class XmlController2 extends AbstractController{

	
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		//return test1(request,response);	//测试1
		return test2(request,response);	//测试1
	}
	
	private ModelAndView test1(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		//1、收集参数
		//2、绑定参数到命令对象
		//3、调用业务对象
		//4、选择下一个页面
		ModelAndView mv = new ModelAndView();
		//添加模型数据 可以是任意的POJO对象
		mv.addObject("message", "Hello World!");
		//设置逻辑视图名，视图解析器会根据该名字解析到具体的视图页面
		mv.setViewName("hello");
		return mv;
	}
	

	private ModelAndView test2(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		System.out.println("Invoke test2");
		response.getWriter().write("<a href=''>this</a>");
		
		return null;
	}

	
	
}
